home *** CD-ROM | disk | FTP | other *** search
- Path: lori.albany.net!usenet
- From: sb0781@albany.net (Stephen Behnfeldt)
- Newsgroups: comp.lang.c++
- Subject: Re: Dynamically allocated interrupt handlers?
- Date: Fri, 22 Mar 1996 02:52:10 GMT
- Organization: AlbanyNet - E-mail info@albany.net
- Message-ID: <4it4o7$3ph@lori.albany.net>
- References: <4iqbv5$mqd@lori.albany.net> <3150C835.3433@airmail.net>
- NNTP-Posting-Host: pm2ip18-albny.albany.net
- X-Newsreader: Forte Free Agent v0.55
-
- Mark Nelson <markn@airmail.net> wrote:
-
- >Stephen Behnfeldt wrote:
- >>
- >> I am building a SerialPort class to model the serial ports on my PC.
- >> Associated with each instance of this class are elements such as an
- >> input character buffer and a hardware address - data members which
- >> will be unique to each instance.
-
- >> So it seems like each handler will have to be
- >> distinct - one for each instance of the class.
-
- >You can minimize this pretty easily. Instead of having N interrupt handlers,
- >you just code N different entry points. The entry points looks something like
- >this:
-
- >_interrupt isr0()
- >{
- > handler(0);
- >}
-
- >_interrupt isr1()
- >{
- > handler(1);
- >}
-
- >...
-
- >Then, your handler routine simply uses the number as an index into a
- >table of pointers. The table has pointers to C++ objects, which then
- >means you are back in object oriented land, where you belong.
-
- >I cover this in some detail in my book "Serial Communications: A C++
- >Developer's Guide." For more information on the book, follow the
- >links on my home page.
-
- >Mark Nelson
- >http://web2.airmail.net/markn
-
- This would make it easier to code a finite number of handlers; but
- what about coding for an indeterminate number of hardware devices?
-
-
- --spb
-
-
-